function formatData(date){
    if(!date) return '';
    let data = new Date(date);
    let year = (data.getFullYear()<10) ? '0'+data.getFullYear() : data.getFullYear();
    let month = (data.getMonth()<10) ? '0'+(data.getMonth()+1) : data.getMonth()+1;
    let day = (data.getDate()<10) ? '0'+data.getDate() : data.getDate();
    let hour = (data.getHours()<10) ? '0'+data.getHours() : data.getHours();
    let min = (data.getMinutes()<10) ? '0'+data.getMinutes() : data.getMinutes();
    let secd =  (data.getSeconds()<10) ? '0'+data.getSeconds() : data.getSeconds();
    return year+'/'+month+'/'+day+" "+hour+":"+min+":"+secd;
}

function deepCopy(obj){
    let data = null;
    if(Array.isArray(obj)){
        data = [];
        obj.forEach(element => {
            if(typeof element === 'object'){
                data.push(deepCopy(element))
            }else{
                data.push(element);
            }
        });
    }else if(Object.prototype.toString.call(obj)==='[object Object]'){
        data = {}
        for(var attr in obj){
            if(typeof obj[attr] === 'object'){
                data[attr] = deepCopy(obj[attr])
            }else{
                data[attr] = obj[attr];
            }
            
        }
    }
    return data;
}



export {
    formatData,
    deepCopy
}